package com.ibm.dao;



import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
//import java.sql.Statement;
import java.util.ArrayList;

import com.ibm.bean.News;
import com.ibm.bean.Sort;

public class SortDao {
	private Connection conn;
//	private Statement s;
	private PreparedStatement ps;
	private DbConn dbconn = new DbConn();
	
	
	
	
	
	public ArrayList<News> getSortAll(){
		return null;
	}
	
	public boolean insertSort(Sort sort){
		conn = dbconn.getConn();
		
		String sql = "insert into tb_sort (id,bigSort,smallSort, createTime) values (?, ?, ?, ?)";
		try {
			ps = conn.prepareStatement(sql);
			ps.setInt(1, sort.getId());
			ps.setString(2, sort.getBigSort());
			ps.setString(3, sort.getSmallSort());
			ps.setString(4, sort.getCreateTime());
			
			
			if (ps.executeUpdate() > 0) {
				return true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			dbconn.freeConn(conn, ps, null);
		}
		return false;
	}
	
	
	
	
}
